<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<!-- start the processing -->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../docs/css/style.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title>Apache JMeter - User's Manual: Functions and Variables</title>
<style>
  .code { font-weight: bold; }
</style>
</head>

<body bgcolor="#ffffff" text="#000000" link="#525D76">
<table border="0" cellspacing="0">
<tr>
<td align="left">
<a href="http://www.apache.org"><img style="margin: 0px 30px 0px 0px" title="Apache Software Foundation" width="261" height="106" src="../../docs/images/asf-logo.png" border="0"/></a>
</td>
<td align="right">
<a href="http://jmeter.apache.org/"><img width="259" height="88" src="../../docs/images/jmeter.png" alt="Apache JMeter" title="Apache JMeter" border="0"/></a>
</td>
</tr>
</table>
<table border="0" cellspacing="4">
<tr><td>
<hr noshade size="1"/>
</td></tr>
<tr>
<td align="left" valign="top">
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="regular_expressions.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="properties_reference.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
<br>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#525D76">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="functions"><strong>20. Functions and Variables</strong></a></font>
</td></tr>
<tr><td>
<blockquote>
<p>
JMeter functions are special values that can populate fields of any Sampler or other
element in a test tree.  A function call looks like this:</p><p><tt class="code">${__functionName(var1,var2,var3)}</tt></p><p>
Where &quot;__functionName&quot; matches the name of a function.
<br>

Parentheses surround the parameters sent to the function, for example <tt class="code">${__time(YMD)}</tt>
The actual parameters vary from function to function.
Functions that require no parameters can leave off the parentheses, for example <tt class="code">${__threadNum}</tt>.
</p><p>
If a function parameter contains a comma, then be sure to escape this with &quot;<tt class="code">\</tt>&quot;, otherwise JMeter will treat it as a parameter delimiter.
For example:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
${__time(EEE\, d MMM yyyy)}
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

If the comma is not escaped - e.g. <tt class="code">${__javaScript(Math.max(2,5))}</tt> - you will get an error such as:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
ERROR - jmeter.functions.JavaScript: Error processing Javascript: [Math.max(2]
    org.mozilla.javascript.EvaluatorException: missing ) after argument list (&lt;cmd&gt;#1)
 </pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

 This is because the string &quot;<tt class="code">Math.max(2,5)</tt>&quot; is treated as being two parameters to the __javascript function:<br>

 <tt class="code">Math.max(2</tt> and <tt class="code">5)</tt><br>

 Other error messages are possible.
</p><p>Variables are referenced as follows:
<pre>
${VARIABLE}
</pre>
</p><p>
<b>
If an undefined function or variable is referenced, JMeter does not report/log an error - the reference is returned unchanged.
For example if <tt class="code">UNDEF</tt> is not defined as a variable, then the value of <tt class="code">${UNDEF}</tt> is <tt class="code">${UNDEF}</tt>.
</b>
Variables, functions (and properties) are all case-sensitive.
<b>
JMeter trims spaces from variable names before use, so for example
<tt class="code">${__Random(1,63, LOTTERY )}</tt> will use the variable '<tt class="code">LOTTERY</tt>' rather than '<tt class="code"> LOTTERY </tt>'.
</b>
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Properties are not the same as variables.
Variables are local to a thread; properties are common to all threads,
and need to be referenced using the <tt class="code">__P</tt> or <tt class="code">__property</tt> function.
</td></tr>
</table>
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
When using <tt class="code">\</tt> before a variable for a windows path for example <tt class="code">C:\test\${test}</tt>, ensure you escape the <tt class="code">\</tt>
otherwise JMeter will not interpret the variable, example:
<tt class="code">C:\\test\\${test}</tt>.
<br>

Alternatively, just use <tt class="code">/</tt> instead for the path separator - e.g. <tt class="code">C:/test/${test}</tt> - Windows JVMs will convert the separators as necessary.
</td></tr>
</table>
</p>
<p>List of functions, loosely grouped into types.</p><table>
<tr>
<td bgcolor="#039acc"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Type of function
</font>
</td>
<td bgcolor="#039acc"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Name
</font>
</td>
<td bgcolor="#039acc"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Comment
</font>
</td>
<td bgcolor="#039acc"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Since
</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__threadNum">threadNum</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
get thread number</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.X</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__threadGroupName">threadGroupName</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
get thread group name</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__samplerName">samplerName</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
get the sampler name (label)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.5</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__machineIP">machineIP</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
get the local machine IP address</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.6</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__machineName">machineName</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
get the local machine name</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.X</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__time">time</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
return current time in various formats</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__timeShift">timeShift</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
return a date in various formats with the specified amount of seconds/minutes/hours/days added</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__log">log</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
log (or display) a message (and return the value)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Information</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__logn">logn</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
log (or display) a message (empty return value)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Input</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__StringFromFile">StringFromFile</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
read a line from a file</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Input</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__FileToString">FileToString</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
read an entire file</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.4</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Input</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__CSVRead">CSVRead</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
read from CSV delimited file</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Input</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__XPath">XPath</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Use an XPath expression to read from a file</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.0.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Input</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__StringToFile">StringToFile</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
write a string to a file</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
5.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__counter">counter</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate an incrementing number</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.X</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Formatting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__dateTimeConvert">dateTimeConvert</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Convert a date or time from source to target format</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__digest">digest</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Generate a digest (SHA-1, SHA-256, MD5...)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__intSum">intSum</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
add int numbers</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.8.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__longSum">longSum</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
add long numbers</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__Random">Random</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate a random number</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__RandomDate">RandomDate</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate random date within a specific date range</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__RandomFromMultipleVars">RandomFromMultipleVars</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
extracts an element from the values of a set of variables separated by <tt class="code">|</tt></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__RandomString">RandomString</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate a random string</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.6</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Calculation</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__UUID">UUID</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate a random type 4 UUID</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Scripting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__groovy">groovy</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
run an Apache Groovy script</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Scripting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__BeanShell">BeanShell</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
run a BeanShell script</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.X</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Scripting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__javaScript">javaScript</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
process JavaScript (Nashorn)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Scripting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__jexl2">jexl2</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
evaluate a Commons Jexl2 expression</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jexl2(2.1.1)</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Scripting</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__jexl3">jexl3</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
evaluate a Commons Jexl3 expression</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
jexl3 (3.0)</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Properties</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__isPropDefined">isPropDefined</a> </font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Test if a property exists</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Properties</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__property">property</a> </font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
read a property</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Properties</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__P">P</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
read a property (shorthand method)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Properties</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__setProperty">setProperty</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
set a JMeter property</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Variables</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__split">split</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Split a string into variables</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.0.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Variables</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__eval">eval</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
evaluate a variable expression</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Variables</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__evalVar">evalVar</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
evaluate an expression stored in a variable</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.1</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Properties</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__isVarDefined">isVarDefined</a> </font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Test if a variable exists</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Variables</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__V">V</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
evaluate a variable name</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3RC3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__char">char</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
generate Unicode char values from a list of numbers</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__changeCase">changeCase</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Change case following different modes</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
4.0</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__escapeHtml">escapeHtml</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Encode strings using HTML encoding</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__escapeOroRegexpChars">escapeOroRegexpChars</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
quote meta chars used by ORO regular expression</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.9</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__escapeXml">escapeXml</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Encode strings using XMl encoding</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
3.2</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__regexFunction">regexFunction</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
parse previous response using a regular expression</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
1.X</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__unescape">unescape</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Process strings containing Java escapes (e.g. \n &amp; \t)</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__unescapeHtml">unescapeHtml</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Decode HTML-encoded strings</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.3.3</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__urldecode">urldecode</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Decode a application/x-www-form-urlencoded string</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.10</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__urlencode">urlencode</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Encode a string to a application/x-www-form-urlencoded string</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.10</font>
</td>
</tr>
<tr>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
String</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
 <a href="#__TestPlanName">TestPlanName</a></font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Return name of current test plan</font>
</td>
<td bgcolor="#a0ddf0"   valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
2.6</font>
</td>
</tr>
</table>
<p></p><table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="what_can_do"><strong>20.1 What can functions do</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>There are two kinds of functions: user-defined static values (or variables), and built-in functions.<br>

User-defined static values allow the user to define variables to be replaced with their static value when
a test tree is compiled and submitted to be run.  This replacement happens once at the beginning of the test
run.  This could be used to replace the DOMAIN field of all HTTP requests, for example - making it a simple
matter to change a test to target a different server with the same test.
</p><p>
Note that variables cannot currently be nested; i.e. <tt class="code">${Var${N}}</tt> does not work.
The <tt class="code">__V</tt> (variable) function can be used to do this: <tt class="code">${__V(Var${N})}</tt>.
You can also use <tt class="code">${__BeanShell(vars.get(&quot;Var${N}&quot;)}</tt>.
</p><p>This type of replacement is possible without functions, but was less convenient and less intuitive.
It required users to create default config elements that would fill in blank values of Samplers.
Variables allow one to replace only part of any given value, not just filling in blank values.</p><p>
With built-in functions users can compute new values at run-time based on previous response data, which
thread the function is in, the time, and many other sources.  These values are generated fresh for every
request throughout the course of the test. </p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Functions are shared between threads.
Each occurrence of a function call in a test plan is handled by a separate function instance.</td></tr>
</table>
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="where"><strong>20.2 Where can functions and variables be used?</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Functions and variables can be written into any field of any test component (apart from the TestPlan - see below).
Some fields do not allow random strings
because they are expecting numbers, and thus will not accept a function.  However, most fields will allow
functions.
</p><p>
Functions which are used on the Test Plan have some restrictions.
JMeter thread variables will have not been fully set up when the functions are processed,
so variable names passed as parameters will not be set up, and variable references will not work,
so <tt class="code">split()</tt> and <tt class="code">regex()</tt> and the variable evaluation functions won't work.
The <tt class="code">threadNum()</tt> function won't work (and does not make sense at test plan level).
The following functions should work OK on the test plan:
<ul>
<li>intSum</li>
<li>longSum</li>
<li>machineName</li>
<li>BeanShell</li>
<li>groovy</li>
<li>javaScript</li>
<li>jexl2/jexl3</li>
<li>random</li>
<li>time</li>
<li>property functions</li>
<li>log functions</li>
</ul>
</p><p>
Configuration elements are processed by a separate thread.
Therefore functions such as <tt class="code">__threadNum</tt> do not work properly in elements such as User Defined Variables.
Also note that variables defined in a UDV element are not available until the element has been processed.
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>When using variable/function references in SQL code (etc.),
remember to include any necessary quotes for text strings,
i.e. use
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
SELECT item from table where name='${VAR}'
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

<b>not</b>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
SELECT item from table where name=${VAR}
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

(unless <tt class="code">VAR</tt> itself contains the quotes)
</td></tr>
</table>
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="how"><strong>20.3 How to reference variables and functions</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>Referencing a variable in a test element is done by bracketing the variable name with '<tt class="code">${</tt>' and '<tt class="code">}</tt>'.</p><p>Functions are referenced in the same manner, but by convention, the names of
functions begin with &quot;<tt class="code">__</tt>&quot; to avoid conflict with user value names<sup>*</sup>.  Some functions take arguments to
configure them, and these go in parentheses, comma-delimited.  If the function takes no arguments, the parentheses can
be omitted.</p><p><b>Argument values that themselves contain commas should be escaped as necessary.
If you need to include a comma in your parameter value, escape it like so: '<tt class="code">\,</tt>'.</b>
This applies for example to the scripting functions - Javascript, Beanshell, Jexl, groovy - where it is necessary to escape any commas
that may be needed in script method calls - e.g.
</p><pre>
${__BeanShell(vars.put(&quot;name&quot;\,&quot;value&quot;))}
</pre><p>
Alternatively, you can define your script as a variable, e.g. on the Test Plan:
<pre>SCRIPT          vars.put(&quot;name&quot;,&quot;value&quot;)</pre>
The script can then be referenced as follows:
<pre>${__BeanShell(${SCRIPT})}</pre>
There is no need to escape commas in the <tt class="code">SCRIPT</tt> variable because the function call is parsed before the variable is replaced with its value.
This works well in conjunction with the JSR223 or BeanShell Samplers, as these can be used to test Javascript, Jexl and BeanShell scripts.
</p><p>
Functions can reference variables and other functions, for example
<tt class="code">${__XPath(${__P(xpath.file),${XPATH})}</tt>
will use the property &quot;<tt class="code">xpath.file</tt>&quot; as the file name
and the contents of the variable <tt class="code">XPATH</tt> as the expression to search for.
</p><p>
JMeter provides a tool to help you construct
function calls for various built-in functions, which you can then copy-paste.
It will not automatically escape values for you, since functions can be parameters to other functions, and you should only escape values you intend as literal.
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
If a string contains a backslash('<tt class="code">\</tt>') and also contains a function or variable reference, the backslash will be removed if
it appears before '<tt class="code">$</tt>' or '<tt class="code">,</tt>' or '<tt class="code">\</tt>'.
This behaviour is necessary to allow for nested functions that include commas or the string <tt class="code">${</tt>.
Backslashes before '<tt class="code">$</tt>' or '<tt class="code">,</tt>' or '<tt class="code">\</tt>' are not removed if the string does not contain a function or variable reference.
</td></tr>
</table>
</p>
<p>
<b>The value of a variable or function can be reported</b> using the <a href="#__logn"><tt class="code">__logn()</tt></a> function.
The <tt class="code">__logn()</tt> function reference can be used anywhere in the test plan after the variable has been defined.
Alternatively, the Java Request sampler can be used to create a sample containing variable references;
the output will be shown in the appropriate Listener.
Note there is a <a href="../usermanual/component_reference.html#Debug_Sampler">Debug Sampler</a>
that can be used to display the values of variables etc. in the Tree View Listener.
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td><sup>*</sup>If you define a user-defined static variable with the same name as a built-in function, your static
variable will override the built-in function.</td></tr>
</table>
</p>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="function_helper"><strong>20.4 The Function Helper Dialog</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>The Function Helper dialog is available from JMeter's Tools menu.</p><table border="0" cellspacing="0" cellpadding="0"><tr><td><img width='831' height='305' src="../../docs/images/screenshots/function_helper_dialog.png"/><br>
<font size="-1">Function Helper Dialog</font></td></tr></table>
<p>Using the Function Helper, you can select a function from the pull down, and assign
values for its arguments.  The left column in the table provides a brief description of the
argument, and the right column is where you write in the value for that argument.  Different
functions take different arguments.</p><p>Once you have done this, click the &quot;generate&quot; button, and the appropriate string is generated
for you to copy-paste into your test plan wherever you like.</p></blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="functions"><strong>20.5 Functions</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__regexFunction">20.5.1 __regexFunction</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The Regex Function is used to parse the previous response (or the value of a variable) using any regular
expression (provided by user).  The function returns the template string with variable values filled
in.</p>
<p>The <tt class="code">__regexFunction</tt> can also store values for future use.  In the sixth parameter, you can specify
a reference name.  After this function executes, the same values can be retrieved at later times
using the syntax for user-defined values.  For instance, if you enter &quot;<tt class="code">refName</tt>&quot; as the sixth
parameter you will be able to use:
<ul>
<li><tt class="code">${refName}</tt> to refer to the computed result of the second parameter (&quot;Template for the
replacement string&quot;) parsed by this function</li>
<li><tt class="code">${refName_g0}</tt> to refer to the entire match  parsed by this function.</li>
<li><tt class="code">${refName_g1}</tt> to refer to the first group parsed by this function.</li>
<li><tt class="code">${refName_g#}</tt> to refer to the n<sup>th</sup> group parsed by this function.</li>
<li><tt class="code">${refName_matchNr}</tt> to refer to the number of groups found by this function.</li>
</ul>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>If using distributed testing, ensure you switch mode (see <tt class="code">jmeter.properties</tt>) so that it's not a stripping one, see <a href="https://bz.apache.org/bugzilla/show_bug.cgi?id=56376">Bug 56376</a>
</td></tr>
</table>
</p>

</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>First argument</td>
<td>The first argument is the regular expression
        to be applied to the response data.  It will grab all matches.  Any parts of this expression
        that you wish to use in your template string, be sure to surround in parentheses.  Example:
        <tt class="code">&lt;a href=&quot;(.*)&quot;&gt;</tt>.  This will grab the value of the link and store it as the first group (there is
        only 1 group).  Another example: <tt class="code">&lt;input type=&quot;hidden&quot; name=&quot;(.*)&quot; value=&quot;(.*)&quot;&gt;</tt>.  This will
        grab the name as the first group, and the value as the second group.  These values can be used
        in your template string</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Second argument</td>
<td>This is the template string that will replace
        the function at run-time.  To refer to a group captured in the regular expression, use the syntax:
        <tt class="code">$[group_number]$</tt>.  I.e.: <tt class="code">$1$</tt>, or <tt class="code">$2$</tt>.  Your template can be any string.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Third argument</td>
<td>The third argument tells JMeter which match
        to use.  Your regular expression might find numerous matches.  You have four choices:
                <ul><li>An integer - Tells JMeter to use that match.  '<tt class="code">1</tt>' for the first found match, '<tt class="code">2</tt>' for the
                second, and so on</li>
                <li><tt class="code">RAND</tt> - Tells JMeter to choose a match at random.</li>
                <li><tt class="code">ALL</tt> - Tells JMeter to use all matches, and create a template string for each one and then
                append them all together.  This option is little used.</li>
                <li>A float number between 0 and 1 - tells JMeter to find the X<sup>th</sup> match using the formula:
                (number_of_matches_found * float_number) rounded to nearest integer.</li>
                </ul></td>
<td>
No, default=1
</td>
</tr>
<tr>
<td>Fourth argument</td>
<td>If '<tt class="code">ALL</tt>' was selected for the above argument
        value, then this argument will be inserted between each appended copy of the template value.</td>
<td>
No
</td>
</tr>
<tr>
<td>Fifth argument</td>
<td>Default value returned if no match is found</td>
<td>
No
</td>
</tr>
<tr>
<td>Sixth argument</td>
<td>A reference name for reusing the values parsed by this function.<br>

        Stored values are <tt class="code">${refName}</tt> (the replacement template string) and <tt class="code">${refName_g#}</tt> where &quot;<tt class="code">#</tt>&quot; is the
        group number from the regular expression (&quot;<tt class="code">0</tt>&quot; can be used to refer to the entire match).</td>
<td>
No
</td>
</tr>
<tr>
<td>Seventh argument</td>
<td>Input variable name.
        If specified, then the value of the variable is used as the input instead of using the previous sample result.
        </td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__counter">20.5.2 __counter</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The counter generates a new number each time it is called, starting with 1
and incrementing by +1 each time.  The counter can be configured to keep each simulated user's values
separate, or to use the same counter for all users.  If each user's values is incremented separately,
that is like counting the number of iterations through the test plan.  A global counter is like
counting how many times that request was run.
</p>
<p>The counter uses an integer variable to hold the count, which therefore has a maximum of 2,147,483,647.</p>
<p>The counter function instances are completely independent.
The global counter - &quot;<tt class="code">FALSE</tt>&quot; - is separately maintained by each counter instance.
</p>
<p>
<b>
Multiple <tt class="code">__counter</tt> function calls in the same iteration won't increment the value further.
</b>
<br>

If you want to have a count that increments for each sample, use the function in a Pre-Processor such as <a href="../usermanual/component_reference.html#User_Parameters">User Parameters</a>.
</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>First argument</td>
<td><tt class="code">TRUE</tt> if you wish each simulated user's counter
        to be kept independent and separate from the other users.  <tt class="code">FALSE</tt> for a global counter.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Second argument</td>
<td>A reference name for reusing the value created by this function.<br>

                Stored values are of the form <tt class="code">${refName}</tt>.  This allows you to keep one counter and refer to its value in
                multiple places.</td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__threadNum">20.5.3a __threadNum</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The thread number function simply returns the number of the thread currently
being executed.  These numbers are only locally unique with respect to their ThreadGroup, meaning thread #1 in one threadgroup
is indistinguishable from thread #1 in another threadgroup, from the point of view of this function.</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>The function returns a number between one and the max number of running threads. Note that if you're using
JSR223 code with <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object (<tt class="code">ctx</tt> variable),
the below code returns a number between zero and (max number of running threads minus one)
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>ctx.getThreadNum()</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

</td></tr>
</table>
</p>


<p>There are no arguments for this function.</p>
<p>Usage Example:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__threadNum}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns a number between 1 and the max number of running threads configured in the containing Thread Group
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
This function does not work in any Configuration elements (e.g. User Defined Variables) as these are run from a separate thread.
Nor does it make sense to use it on the Test Plan.
</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__threadGroupName">20.5.3b __threadGroupName</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The thread group name function simply returns the name of the thread group
being executed.</p>

<p>There are no arguments for this function.</p>
<p>Usage Example:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__threadGroupName}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
This function does not work in any Configuration elements (e.g. User Defined Variables) as these are run from a separate thread.
Nor does it make sense to use it on the Test Plan.
</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__intSum">20.5.4a __intSum</a>
</h3>
</font>
</td></tr>
<tr><td>

<p>
The intSum function can be used to compute the sum of two or more integer values.
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The reference name is optional, but it must not be a valid integer.
</td></tr>
</table>
</p>

<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>First argument</td>
<td>The first int value.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Second argument</td>
<td>The second int value.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>nth argument</td>
<td>The n<sup>th</sup> int value.</td>
<td>
No
</td>
</tr>
<tr>
<td>last argument</td>
<td>A reference name for reusing the value computed by this function.
                If specified, the reference name must contain at least one non-numeric character otherwise it will
                be treated as another int value to be added.
        </td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__intSum(2,5,MYVAR)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 7 (2+5) and store the result in MYVAR variable. So <tt class="code">${MYVAR}</tt> will be equal to 7. <br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__intSum(2,5,7)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 14 (2+5+7) and store the result in MYVAR variable. <br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__intSum(1,2,5,${MYVAR})}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 16 if MYVAR value is equal to 8, 1+2+5+${MYVAR})<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__longSum">20.5.4b __longSum</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The longSum function can be used to compute the sum of two or more long values, use this instead of __intSum whenever you know your values will not
be in the interval -2147483648 to 2147483647.
</p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>First argument</td>
<td>The first long value.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Second argument</td>
<td>The second long value.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>nth argument</td>
<td>The n<sup>th</sup> long value.</td>
<td>
No
</td>
</tr>
<tr>
<td>last argument</td>
<td>A reference name for reusing the value computed by this function.
                If specified, the reference name must contain at least one non-numeric character otherwise it will
                be treated as another long value to be added.
        </td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__longSum(2,5,MYVAR)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 7 (2+5) and store the result in MYVAR variable. So <tt class="code">${MYVAR}</tt> will be equal to 7. <br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__longSum(2,5,7)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 14 (2+5+7) and store the result in MYVAR variable. <br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__longSum(1,2,5,${MYVAR})}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return 16 if MYVAR value is equal to 8, 1+2+5+${MYVAR})<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__StringFromFile">20.5.5 __StringFromFile</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The StringFromFile function can be used to read strings from a text file.
    This is useful for running tests that require lots of variable data.
    For example when testing a banking application, 100s or 1000s of different account numbers might be required.
    </p>
    <p>
    See also the
    <a href="component_reference.html#CSV_Data_Set_Config">CSV Data Set Config test element</a>
    which may be easier to use. However, that does not currently support multiple input files.
    </p>

    <p>
    Each time it is called it reads the next line from the file.
    All threads share the same instance, so different threads will get different lines.
    When the end of the file is reached, it will start reading again from the beginning,
    unless the maximum loop count has been reached.
    If there are multiple references to the function in a test script, each will open the file independently,
    even if the file names are the same.
    [If the value is to be used again elsewhere, use different variable names for each function call.]
    </p>
    <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
    Function instances are shared between threads, and the file is (re-)opened by whatever thread
    happens to need the next line of input, so using the <tt class="code">threadNumber</tt> as part of the file name
    will result in unpredictable behaviour.
    </td></tr>
</table>
</p>

    <p>If an error occurs opening or reading the file, then the function returns the string &quot;<tt class="code">**ERR**</tt>&quot;</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>File Name</td>
<td>Path to the file name.
            (The path can be relative to the JMeter launch directory)
            If using optional sequence numbers, the path name should be suitable for passing to DecimalFormat.
            See below for examples.
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>
A reference name - <tt class="code">refName</tt> - for reusing the value created by this function. Stored values are of the form <tt class="code">${refName}</tt>.
Defaults to &quot;<tt class="code">StringFromFile_</tt>&quot;.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Start sequence number</td>
<td>Initial Sequence number (if omitted, the End sequence number is treated as a loop count)</td>
<td>
No
</td>
</tr>
<tr>
<td>End   sequence number</td>
<td>Final sequence number (if omitted, sequence numbers can increase without limit)</td>
<td>
No
</td>
</tr>
</table>
<p>The file name parameter is resolved when the file is opened or re-opened.</p><p>The reference name parameter (if supplied) is resolved every time the function is executed.</p><p><b>Using sequence numbers:</b></p><p>When using the optional sequence numbers, the path name is used as the format string for <tt class="code">java.text.DecimalFormat</tt>.
    The current sequence number is passed in as the only parameter.
    If the optional start number is not specified, the path name is used as is.
    Useful formatting sequences are:
    </p><dl>
<dt><tt class="code">#</tt></dt><dd>insert the number, with no leading zeros or spaces</dd>
<dt><tt class="code">000</tt></dt><dd>insert the number packed out to three digits with leading zeros if necessary</dd>
</dl><a name="string-from-file-format-examples"/>
<p><b>Usage of format strings</b></p>

Here are a few format strings and the corresponding sequences they will generate.
<dl>
  <dt><tt class="code">pin#'.'dat</tt></dt><dd>Will generate the digits without leading zeros and treat the dot literally like<br>

    <tt class="code">pin1.dat</tt>, …, <tt class="code">pin9.dat</tt>, <tt class="code">pin10.dat</tt>, …, <tt class="code">pin9999.dat</tt></dd>
  <dt><tt class="code">pin000'.'dat</tt></dt><dd>Will generate leading zeros while keeping the dot. When the numbers start having more digits
    then those three digits that this format suggests, the sequence will use more digits as can be seen in<br>

    <tt class="code">pin001.dat</tt>, … <tt class="code">pin099.dat</tt>, …, <tt class="code">pin999.dat</tt>, …, <tt class="code">pin9999.dat</tt></dd>
  <dt><tt class="code">pin'.'dat#</tt></dt><dd>Will append digits without leading zeros while keeping the dot and generate<br>

    <tt class="code">pin.dat1</tt>, …, <tt class="code">pin.dat9</tt>, …, <tt class="code">pin.dat999</tt></dd>
</dl>
<p>
    If more digits are required than there are formatting characters, the number will be
    expanded as necessary.<br>

    <b>To prevent a formatting character from being interpreted,
    enclose it in single quotes. Note that &quot;<tt class="code">.</tt>&quot; is a formatting character,
    and must be enclosed in single quotes</b>
    (though <tt class="code">#.</tt> and <tt class="code">000.</tt> work as expected in locales where the decimal point is also &quot;<tt class="code">.</tt>&quot;)
    <br>

    In other locales (e.g. <tt class="code">fr</tt>), the decimal point is &quot;<tt class="code">,</tt>&quot; - which means that &quot;<tt class="code">#.</tt>&quot;
    becomes &quot;<tt class="code">nnn,</tt>&quot;.<br>

    See the documentation for <tt class="code">DecimalFormat</tt> for full details.<br>

    If the path name does not contain any special formatting characters,
    the current sequence number will be appended to the name, otherwise
    the number will be inserted according to the formatting instructions.<br>

    If the start sequence number is omitted, and the end sequence number is specified,
    the sequence number is interpreted as a loop count, and the file will be used at most &quot;<tt class="code">end</tt>&quot; times.
    In this case the filename is not formatted.
    <br>

    <tt class="code">${__StringFromFile(PIN#'.'DAT,,1,2)}</tt> - reads <tt class="code">PIN1.DAT</tt>, <tt class="code">PIN2.DAT</tt><br>

    <tt class="code">${__StringFromFile(PIN.DAT,,,2)}</tt> - reads <tt class="code">PIN.DAT</tt> twice<br>

    Note that the &quot;<tt class="code">.</tt>&quot; in <tt class="code">PIN.DAT</tt> above should <u>not</u> be quoted.
    In this case the start number is omitted, so the file name is used exactly as is.
    </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__machineName">20.5.6a __machineName</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The machineName function returns the local host name. This uses the Java method <tt class="code">InetAddress.getLocalHost()</tt> and passes it to <tt class="code">getHostName()</tt></p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__machineName()}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return the host name of the machine<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__machineName}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return the host name of the machine<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__machineIP">20.5.6b __machineIP</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The machineIP function returns the local IP address. This uses the Java method <tt class="code">InetAddress.getLocalHost()</tt> and passes it to <tt class="code">getHostAddress()</tt></p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__machineIP()}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return the IP address of the machine<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__machineIP}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return the IP address of the machine<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__javaScript">20.5.7 __javaScript</a>
</h3>
</font>
</td></tr>
<tr><td>

<p>
The javaScript function executes a piece of JavaScript (not Java!) code and returns its value
</p>
<p>
The JMeter Javascript function calls a standalone JavaScript interpreter.
Javascript is used as a scripting language, so you can do calculations etc.</p>
<p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>javaScript is not the best scripting language for performances in JMeter. If your plan requires a high number of threads
it is advised to use <tt class="code">__jexl3</tt> or <tt class="code">__groovy</tt> functions.
</td></tr>
</table>
</p>


For Nashorn Engine, please see <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/">Java Platform, Standard Edition Nashorn User's Guide</a>.<br>

For Rhino engine, please see <a href="http://www.mozilla.org/rhino/overview.html">Mozilla Rhino Overview</a>
</p>
<p>
The following variables are made available to the script:
</p>
<ul>
<li><tt class="code">log</tt> - the <a href="https://www.slf4j.org/api/org/slf4j/Logger.html">Logger</a> for the function</li>
<li><tt class="code">ctx</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object</li>
<li><tt class="code">vars</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterVariables.html">JMeterVariables</a> object</li>
<li><tt class="code">threadName</tt> - String containing the current thread name</li>
<li><tt class="code">sampler</tt> - current <a href="../../docs/api/org/apache/jmeter/samplers/Sampler.html">Sampler</a> object (if any)</li>
<li><tt class="code">sampleResult</tt> - previous <a href="../../docs/api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a> object (if any)</li>
<li><tt class="code">props</tt> - JMeterProperties (class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html"><tt class="code">java.util.Properties</tt></a>) object</li>
</ul>
<p>
Rhinoscript allows access to static methods via its Packages object.
See the <a href="https://wiki.openjdk.java.net/display/Nashorn/Rhino+Migration+Guide">Scripting Java</a> documentation.
For example one can access the JMeterContextService static methods thus:
<tt class="code">Java.type(&quot;org.apache.jmeter.threads.JMeterContextService&quot;).getTotalThreads()</tt>
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
JMeter is not a browser, and does not interpret the JavaScript in downloaded pages.
</td></tr>
</table>
</p>

<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Expression</td>
<td>The JavaScript expression to be executed. For example:
            <ul>
                <li><tt class="code">new Date()</tt> - return the current date and time</li>
                <li><tt class="code">Math.floor(Math.random()*(${maxRandom}+1))</tt>
                    - a random number between <tt class="code">0</tt> and the variable <tt class="code">maxRandom</tt></li>
                <li><tt class="code">${minRandom}+Math.floor(Math.random()*(${maxRandom}-${minRandom}+1))</tt>
                    - a random number between the variables <tt class="code">minRandom</tt> and <tt class="code">maxRandom</tt></li>
                <li><tt class="code">&quot;${VAR}&quot;==&quot;abcd&quot;</tt></li>
            </ul>
            </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Remember to include any necessary quotes for text strings and JMeter variables. Also, if
the expression has commas, please make sure to escape them. For example in:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
${__javaScript('${sp}'.slice(7\,99999))}
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

the comma after <tt class="code">7</tt> is escaped.</td></tr>
</table>
</p>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__javaScript(new Date())}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">Sat Jan 09 2016 16:22:15 GMT+0100 (CET)</tt><br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__javaScript(new Date(),MYDATE)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">Sat Jan 09 2016 16:22:15 GMT+0100 (CET)</tt> and store it under variable <tt class="code">MYDATE</tt><br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__javaScript(Math.floor(Math.random()*(${maxRandom}+1)),MYRESULT)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will use maxRandom variable, return a random value between 0 and maxRandom and store it in MYRESULT
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__javaScript(${minRandom}+Math.floor(Math.random()*(${maxRandom}-${minRandom}+1)),MYRESULT)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will use <tt class="code">maxRandom</tt> and <tt class="code">minRandom</tt> variables, return a random value between <tt class="code">maxRandom</tt> and <tt class="code">minRandom</tt> and store it under variable <tt class="code">MYRESULT</tt>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__javaScript(&quot;${VAR}&quot;==&quot;abcd&quot;,MYRESULT)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will compare the value of <tt class="code">VAR</tt> variable with <tt class="code">abcd</tt>, return <tt class="code">true</tt> or <tt class="code">false</tt> and store the result in MYRESULT
</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__Random">20.5.8 __Random</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The random function returns a random number that lies between the given min and max values.</p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Minimum value</td>
<td>A number</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Maximum value</td>
<td>A bigger number</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__Random(0,10)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random number between 0 and 10<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__Random(0,10, MYVAR)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random number between 0 and 10 and store it in <tt class="code">MYVAR</tt>. <tt class="code">${MYVAR}</tt> will contain the random number<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__RandomDate">20.5.8 __RandomDate</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The RandomDate function returns a random date that lies between the given start date and end date values.</p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Time format</td>
<td>Format string for DateTimeFormatter (default <tt class="code">yyyy-MM-dd</tt>)</td>
<td>
No
</td>
</tr>
<tr>
<td>Start date</td>
<td>The start date, the default is <em>now</em></td>
<td>
No
</td>
</tr>
<tr>
<td>End date</td>
<td>The end date</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Locale to use for format</td>
<td>
        The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore, e.g. <tt class="code">en_EN</tt>.
        See <a href="http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html">http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html</a>.
        If omitted, by default the function uses the Apache JMeter locale one.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomDate(,,2050-07-08,,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random date between <em>now</em> and <tt class="code">2050-07-08</tt>. For example <tt class="code">2039-06-21</tt><br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomDate(dd MM yyyy,,08 07 2050,,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random date with a custom format like <tt class="code">04 03 2034</tt><br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__RandomString">20.5.8 __RandomString</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The RandomString function returns a random String of length using characters in chars to use.</p><p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Length</td>
<td>A number length of generated String</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Characters to use</td>
<td>Chars used to generate String</td>
<td>
No
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomString(5)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string of 5 characters which can be readable or not<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomString(10,abcdefg)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string of 10 characters picked from <tt class="code">abcdefg</tt> set, like <tt class="code">cdbgdbeebd</tt> or <tt class="code">adbfeggfad</tt>, …<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomString(6,a12zeczclk, MYVAR)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string of 6 characters picked from <tt class="code">a12zeczclk</tt> set and store the result in <tt class="code">MYVAR</tt>, <tt class="code">MYVAR</tt> will contain
string like <tt class="code">2z22ak</tt> or <tt class="code">z11kce</tt>, …<br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__RandomFromMultipleVars">20.5.8 __RandomFromMultipleVars</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The RandomFromMultipleVars function returns a random value based on the variable values provided by <tt class="code">Source Variables</tt>.</p>
The variables can be simple or multi-valued as they can be generated by the following extractors:
<ul>
    <li><a href="component_reference.html#Boundary_Extractor">Boundary Extractor</a></li>
    <li><a href="component_reference.html#Regular_Expression_Extractor">Regular Expression Extractor</a></li>
    <li><a href="component_reference.html#CSS_Selector_Extractor">CSS Selector Extractor</a></li>
    <li><a href="component_reference.html#JSON_Extractor">JSON Extractor</a></li>
    <li><a href="component_reference.html#XPath_Extractor">XPath Extractor</a></li>
    <li><a href="component_reference.html#XPath2_Extractor">XPath2 Extractor</a></li>
</ul>

Multi-value vars are the ones that are extracted when you set <tt class="code">-1</tt> for <tt class="code">Match Numbers</tt>.
This leads to creation of match number variable called <tt class="code">varName_matchNr</tt> and for each value to the creation of variable <tt class="code">varName_n</tt> where n = 1, 2, 3 etc.

<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Source Variables</td>
<td>Variable names separated by <tt class="code">|</tt> that contain the values that will be used as input for random computation</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomFromMultipleVars(val)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string based on content of variable val taking into account whether they are multi-value or not<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomFromMultipleVars(val1|val2)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not<br>

<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__RandomFromMultipleVars(val1|val2, MYVAR)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return a random string based on content of variables val1 and val2 taking into account whether they are multi-value or not and store the result in <tt class="code">MYVAR</tt><br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__UUID">20.5.8 __UUID</a>
</h3>
</font>
</td></tr>
<tr><td>

<p>The UUID function returns a pseudo random type 4 Universally Unique IDentifier (UUID).</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__UUID()}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return UUIDs with this format : <tt class="code">c69e0dd1-ac6b-4f2b-8d59-5d4e8743eecd</tt> <br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__CSVRead">20.5.8 __CSVRead</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The CSVRead function returns a string from a CSV file (c.f. <a href="#__StringFromFile">StringFromFile</a>)</p>
    <p>NOTE: JMeter supports multiple file names.
    </p>
    <p><b>In most cases, the newer
    <a href="component_reference.html#CSV_Data_Set_Config">CSV Data Set Config element</a>
     is easier to use.</b></p>
    <p>
    When a filename is first encountered, the file is opened and read into an internal
    array. If a blank line is detected, this is treated as end of file - this allows
    trailing comments to be used.
    </p>
    <p>All subsequent references to the same file name use the same internal array.
    N.B. the filename case is significant to the function, even if the OS doesn't care,
    so <tt class="code">CSVRead(abc.txt,0)</tt> and <tt class="code">CSVRead(aBc.txt,0)</tt> would refer to different internal arrays.
    </p>
    <p>
    The <tt class="code">*ALIAS</tt> feature allows the same file to be opened more than once,
    and also allows for shorter file names.
    </p>
    <p>
    Each thread has its own internal pointer to its current row in the file array.
    When a thread first refers to the file it will be allocated the next free row in
    the array, so each thread will access a different row from all other threads.
    [Unless there are more threads than there are rows in the array.]
    </p>
    <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>The function splits the line at every comma by default.
    If you want to enter columns containing commas, then you will need
    to change the delimiter to a character that does not appear in any
    column data, by setting the property: <tt class="code">csvread.delimiter</tt>
    </td></tr>
</table>
</p>

<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>File Name</td>
<td>The file (or <tt class="code">*ALIAS</tt>) to read from</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Column number</td>
<td>
            The column number in the file.
            <tt class="code">0</tt> = first column, <tt class="code">1</tt> = second etc.
            &quot;<tt class="code">next</tt>&quot; - go to next line of file.
            <tt class="code">*ALIAS</tt> - open a file and assign it to the alias
            </td>
<td>
Yes
</td>
</tr>
</table>
<p>For example, you could set up some variables as follows:
<ul>
<li>COL1a <tt class="code">${__CSVRead(random.txt,0)}</tt></li>
<li>COL2a <tt class="code">${__CSVRead(random.txt,1)}${__CSVRead(random.txt,next)}</tt></li>
<li>COL1b <tt class="code">${__CSVRead(random.txt,0)}</tt></li>
<li>COL2b <tt class="code">${__CSVRead(random.txt,1)}${__CSVRead(random.txt,next)}</tt></li>
</ul>
This would read two columns from one line, and two columns from the next available line.
If all the variables are defined on the same User Parameters Pre-Processor, then the lines
will be consecutive. Otherwise, a different thread may grab the next line.
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
The function is not suitable for use with large files, as the entire file is stored in memory.
For larger files, use <a href="component_reference.html#CSV_Data_Set_Config">CSV Data Set Config element</a>
or <a href="#__StringFromFile">StringFromFile</a>.
</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__property">20.5.9 __property</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>The property function returns the value of a JMeter property.
    If the property value cannot be found, and no default has been supplied, it returns the property name.
    When supplying a default value, there is no need to provide a function name - the parameter can be set to null, and it will be ignored.
    </p>For example:<p>
        <ul>
<li><tt class="code">${__property(user.dir)}</tt> - return value of <tt class="code">user.dir</tt></li>
<li><tt class="code">${__property(user.dir,UDIR)}</tt> - return value of <tt class="code">user.dir</tt> and save in <tt class="code">UDIR</tt></li>
<li><tt class="code">${__property(abcd,ABCD,atod)}</tt> - return value of property <tt class="code">abcd</tt> (or &quot;<tt class="code">atod</tt>&quot; if not defined) and save in <tt class="code">ABCD</tt></li>
<li><tt class="code">${__property(abcd,,atod)}</tt> - return value of property <tt class="code">abcd</tt> (or &quot;<tt class="code">atod</tt>&quot; if not defined) but don't save it</li>
</ul>
</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Property Name</td>
<td>The property name to be retrieved.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>A reference name for reusing the value
                computed by this function.</td>
<td>
No
</td>
</tr>
<tr>
<td>Default Value</td>
<td>The default value for the property.</td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__P">20.5.10 __P</a>
</h3>
</font>
</td></tr>
<tr><td>
<p>This is a simplified property function which is
    intended for use with properties defined on the command line.
    Unlike the <tt class="code">__property</tt> function, there is no option to save the value in a variable,
    and if no default value is supplied, it is assumed to be 1.
    The value of 1 was chosen because it is valid for common test variables such
    as loops, thread count, ramp up etc.
    </p>For example:<p>
<tt class="code">
Define the property value:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
jmeter -Jgroup1.threads=7 -Jhostname1=www.realhost.edu
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>


Fetch the values:
<br>

<tt class="code">${__P(group1.threads)}</tt> - return the value of <tt class="code">group1.threads</tt>
<br>

<tt class="code">${__P(group1.loops)}</tt> - return the value of <tt class="code">group1.loops</tt>
<br>

<tt class="code">${__P(hostname,www.dummy.org)}</tt> - return value of property <tt class="code">hostname</tt> or <tt class="code">www.dummy.org</tt> if not defined
<br>

</tt>
In the examples above, the first function call would return <tt class="code">7</tt>,
the second would return <tt class="code">1</tt> and the last would return <tt class="code">www.dummy.org</tt>
(unless those properties were defined elsewhere!)
</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Property Name</td>
<td>The property name to be retrieved.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Default Value</td>
<td>The default value for the property.
            If omitted, the default is set to &quot;<tt class="code">1</tt>&quot;.</td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__log">20.5.11 __log</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The log function logs a message, and returns its input string
    </p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to be logged</td>
<td>A string</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Log Level</td>
<td><tt class="code">OUT</tt>, <tt class="code">ERR</tt>, <tt class="code">DEBUG</tt>, <tt class="code">INFO</tt> (default), <tt class="code">WARN</tt> or <tt class="code">ERROR</tt></td>
<td>
No
</td>
</tr>
<tr>
<td>Throwable text</td>
<td>If non-empty, creates a Throwable to pass to the logger</td>
<td>
No
</td>
</tr>
<tr>
<td>Comment</td>
<td>If present, it is displayed in the string.
        Useful for identifying what is being logged.</td>
<td>
No
</td>
</tr>
</table>
<p>The <tt class="code">OUT</tt> and <tt class="code">ERR</tt> log level names are used to direct the output to <tt class="code">System.out</tt> and <tt class="code">System.err</tt> respectively.
    In this case, the output is always printed - it does not depend on the current log setting.
</p><dl>
  <dt><tt class="code">${__log(Message)}</tt></dt><dd>written to the log file as   &quot;<tt class="code"> … thread Name : Message</tt>&quot;</dd>
  <dt><tt class="code">${__log(Message,OUT)}</tt></dt><dd>written to console window</dd>
  <dt><tt class="code">${__log(${VAR},,,VAR=)}</tt></dt><dd>written to log file as &quot;<tt class="code"> … thread Name VAR=value</tt>&quot;</dd>
</dl></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__logn">20.5.12 __logn</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The logn function logs a message, and returns the empty string
    </p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to be logged</td>
<td>A string</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Log Level</td>
<td><tt class="code">OUT</tt>, <tt class="code">ERR</tt>, <tt class="code">DEBUG</tt>, <tt class="code">INFO</tt> (default), <tt class="code">WARN</tt> or <tt class="code">ERROR</tt></td>
<td>
No
</td>
</tr>
<tr>
<td>Throwable text</td>
<td>If non-empty, creates a Throwable to pass to the logger</td>
<td>
No
</td>
</tr>
</table>
<p>The <tt class="code">OUT</tt> and <tt class="code">ERR</tt> log level names are used to direct the output to <tt class="code">System.out</tt> and <tt class="code">System.err</tt> respectively.
    In this case, the output is always printed - it does not depend on the current log setting.
</p><dl>
  <dt><tt class="code">${__logn(VAR1=${VAR1},OUT)}</tt></dt><dd>write the value of the variable to the console window</dd>
</dl></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__BeanShell">20.5.13 __BeanShell</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The BeanShell function evaluates the script passed to it, and returns the result.
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>For performance it is better to use <a href="#__groovy">__groovy</a> function</td></tr>
</table>
</p>

<p>
<b>For full details on using BeanShell, please see the BeanShell web-site at <a href="http://www.beanshell.org/">http://www.beanshell.org/</a>
</b>
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Note that a different Interpreter is used for each independent occurrence of the function
in a test script, but the same Interpreter is used for subsequent invocations.
This means that variables persist across calls to the function.
</td></tr>
</table>
</p>

<p>
A single instance of a function may be called from multiple threads.
However the function <tt class="code">execute()</tt> method is synchronised.
</p>
<p>
If the property &quot;<tt class="code">beanshell.function.init</tt>&quot; is defined, it is passed to the Interpreter
as the name of a sourced file. This can be used to define common methods and variables. There is a
sample init file in the bin directory: <tt class="code">BeanShellFunction.bshrc</tt>.
</p>
<p>
The following variables are set before the script is executed:
<ul>
<li><tt class="code">log</tt> - the <a href="https://www.slf4j.org/api/org/slf4j/Logger.html">Logger</a> for the BeanShell function (*)</li>
<li><tt class="code">ctx</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object</li>
<li><tt class="code">vars</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterVariables.html">JMeterVariables</a> object</li>
<li><tt class="code">props</tt> - JMeterProperties (class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html"><tt class="code">java.util.Properties</tt></a>) object</li>
<li><tt class="code">threadName</tt> - the threadName (String)</li>
<li><tt class="code">Sampler</tt> - the current <a href="../../docs/api/org/apache/jmeter/samplers/Sampler.html">Sampler</a>, if any</li>
<li><tt class="code">SampleResult</tt> - the current <a href="../../docs/api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a>, if any</li>
</ul>
(*) means that this is set before the init file, if any, is processed.
Other variables vary from invocation to invocation.
</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>BeanShell script</td>
<td>A beanshell script (not a file name)</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>A reference name for reusing the value
               computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>
Example:
<dl>
<dt><tt class="code">${__BeanShell(123*456)}</tt></dt><dd>returns <tt class="code">56088</tt></dd>
<dt><tt class="code">${__BeanShell(source(&quot;function.bsh&quot;))}</tt></dt><dd>processes the script in <tt class="code">function.bsh</tt></dd>
</dl>
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Remember to include any necessary quotes for text strings and JMeter variables that represent text strings.
</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__groovy">20.5.13 __groovy</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The <tt class="code">__groovy</tt> function evaluates <a href="http://groovy-lang.org/">Apache Groovy</a> scripts passed to it, and returns the result.
</p>
<p>
If the property &quot;<tt class="code">groovy.utilities</tt>&quot; is defined, it will be loaded by the ScriptEngine.
This can be used to define common methods and variables. There is a
sample init file in the <tt class="code">bin</tt> directory: <tt class="code">utility.groovy</tt>.
</p>
<p>
The following variables are set before the script is executed:
</p>
<ul>
<li><tt class="code">log</tt> - the <a href="https://www.slf4j.org/api/org/slf4j/Logger.html">Logger</a> for the groovy function (*)</li>
<li><tt class="code">ctx</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object</li>
<li><tt class="code">vars</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterVariables.html">JMeterVariables</a> object</li>
<li><tt class="code">props</tt> - JMeterProperties (class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html"><tt class="code">java.util.Properties</tt></a>) object</li>
<li><tt class="code">threadName</tt> - the threadName (String)</li>
<li><tt class="code">sampler</tt> - the current <a href="../../docs/api/org/apache/jmeter/samplers/Sampler.html">Sampler</a>, if any</li>
<li><tt class="code">prev</tt> - the previous <a href="../../docs/api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a>, if any</li>
<li><tt class="code">OUT</tt> - System.out</li>
</ul>
<p>
(*) means that this is set before the init file, if any, is processed.
Other variables vary from invocation to invocation.
</p>
<p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
When using this function please use the variables defined above rather than using string replacement to access a variable in your script.  Following this pattern will ensure that your tests are performant by ensuring that the Groovy can be cached.
</td></tr>
</table>
</p>

<p>
For instance <strong>don't</strong> do the following:
</p>

<p><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__groovy(&quot;${myVar}&quot;.substring(0\,2))}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
</p>

<p>Imagine that the variable myVar changes with each transaction, the Groovy above cannot be cached as the script changes each time.<br>
<br>

Instead do the following, which can be cached: <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__groovy(vars.get(&quot;myVar&quot;).substring(0\,2))}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Expression to evaluate</td>
<td>An Apache Groovy script (not a file name)
        <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Argument values that themselves contain commas should be escaped as necessary.
        If you need to include a comma in your parameter value, escape it like this: '<tt class="code">\,</tt>'</td></tr>
</table>
</p>

        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>A reference name for reusing the value
               computed by this function.</td>
<td>
No
</td>
</tr>
</table>
<p>
Example:
<dl>
<dt><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__groovy(123*456)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
</dt><dd>returns <tt class="code">56088</tt></dd>
<dt><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__groovy(vars.get(&quot;myVar&quot;).substring(0\,2))}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
</dt><dd>If var's value is <tt class="code">JMeter</tt>, it will return <tt class="code">JM</tt> as it runs <tt class="code">String.substring(0,2)</tt>. Note
that <tt class="code">,</tt> has been escaped to <tt class="code">\,</tt> </dd>
</dl>
</p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>
Remember to include any necessary quotes for text strings and JMeter variables that represent text strings.
</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__split">20.5.14 __split</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The split function splits the string passed to it according to the delimiter,
    and returns the original string. If any delimiters are adjacent, &quot;<tt class="code">?</tt>&quot; is returned as the value.
    The split strings are returned in the variables <tt class="code">${VAR_1}</tt>, <tt class="code">${VAR_2}</tt> etc.
    The count of variables is returned in <tt class="code">${VAR_n}</tt>.
    A trailing delimiter is treated as a missing variable, and &quot;<tt class="code">?</tt>&quot; is returned.
    Also, to allow it to work better with the ForEach controller,
    <tt class="code">__split</tt> now deletes the first unused variable in case it was set by a previous split.
    </p>
    <p></p>
    Example:
    <br>

    Define <tt class="code">VAR</tt>=&quot;<tt class="code">a||c|</tt>&quot; in the test plan.
    <br>

    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__split(${VAR},VAR,|)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    <br>

    This will return the contents of <tt class="code">VAR</tt>, i.e. &quot;<tt class="code">a||c|</tt>&quot; and set the following variables:
    <br>

        <tt class="code">VAR_n</tt>=<tt class="code">4</tt>
    <br>

        <tt class="code">VAR_1</tt>=<tt class="code">a</tt>
    <br>

        <tt class="code">VAR_2</tt>=<tt class="code">?</tt>
    <br>

        <tt class="code">VAR_3</tt>=<tt class="code">c</tt>
    <br>

        <tt class="code">VAR_4</tt>=<tt class="code">?</tt>
    <br>

        <tt class="code">VAR_5</tt>=<tt class="code">null</tt>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to split</td>
<td>A delimited string, e.g. &quot;<tt class="code">a|b|c</tt>&quot;</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>A reference name for reusing the value
               computed by this function.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Delimiter</td>
<td>The delimiter character, e.g. <tt class="code">|</tt>.
If omitted, <tt class="code">,</tt> is used. Note that <tt class="code">,</tt> would need to be specified as <tt class="code">\,</tt>.
</td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__XPath">20.5.15 __XPath</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The XPath function reads an XML file and matches the XPath.
    Each time the function is called, the next match will be returned.
    At end of file, it will wrap around to the start.
    If no nodes matched, then the function will return the empty string,
    and a warning message will be written to the JMeter log file.
    <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Note that the entire NodeList is held in memory.</td></tr>
</table>
</p>

    </p>
    <p></p>
    Example:
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__XPath(/path/to/build.xml, //target/@name)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    This will match all targets in <tt class="code">build.xml</tt> and return the contents of the next name attribute
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>XML file to parse</td>
<td> a XML file to parse</td>
<td>
Yes
</td>
</tr>
<tr>
<td>XPath</td>
<td> a XPath expression to match nodes in the XML file</td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__setProperty">20.5.16 __setProperty</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The setProperty function sets the value of a JMeter property.
        The default return value from the function is the empty string,
        so the function call can be used anywhere functions are valid.</p>
        <p>The original value can be returned by setting the optional 3<sup>rd</sup> parameter to &quot;<tt class="code">true</tt>&quot;.</p>
    <p>Properties are global to JMeter,
        so can be used to communicate between threads and thread groups</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Property Name</td>
<td>The property name to be set.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Property Value</td>
<td>The value for the property.</td>
<td>
Yes
</td>
</tr>
<tr>
<td>True/False</td>
<td>Should the original value be returned?</td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__time">20.5.17 __time</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The time function returns the current time in various formats.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Format</td>
<td>
        The format to be passed to <a href="https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a>.
        The function supports various shorthand aliases, see below.
        If omitted, the function returns the current time in milliseconds since the epoch.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>If the format string is omitted, then the function returns the current time in milliseconds since the epoch.
If the format matches &quot;<tt class="code">/ddd</tt>&quot; (where <tt class="code">ddd</tt> are decimal digits),
then the function returns the current time in milliseconds divided by the value of <tt class="code">ddd</tt>.
For example, &quot;<tt class="code">/1000</tt>&quot; returns the current time in seconds since the epoch.
Otherwise, the current time is passed to SimpleDateFormat.
The following shorthand aliases are provided:
</p><ul>
<li><tt class="code">YMD</tt> = <tt class="code">yyyyMMdd</tt></li>
<li><tt class="code">HMS</tt> = <tt class="code">HHmmss</tt></li>
<li><tt class="code">YMDHMS</tt> = <tt class="code">yyyyMMdd-HHmmss</tt></li>
<li><tt class="code">USER1</tt> = whatever is in the JMeter property <tt class="code">time.USER1</tt></li>
<li><tt class="code">USER2</tt> = whatever is in the JMeter property <tt class="code">time.USER2</tt></li>
</ul><p>The defaults can be changed by setting the appropriate JMeter property, e.g.
<tt class="code">time.YMD=yyMMdd</tt>
</p><p><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__time(dd/MM/yyyy,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
  will return <tt class="code">21/01/2018</tt> if ran on 21 january 2018</p><p><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__time(YMD,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
  will return <tt class="code">20180121</tt> if ran on 21 january 2018</p><p><div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__time()}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
  will return time in millis <tt class="code">1516540541624</tt></p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__jexl2">20.5.18 __jexl2</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The jexl function returns the result of evaluating a
    <a href="http://commons.apache.org/jexl">Commons JEXL expression</a>.
    See links below for more information on JEXL expressions.
    </p>
    <p>The <tt class="code">__jexl2</tt> function uses Commons JEXL 2</p>
    <ul>
    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/syntax.html">JEXL syntax description</a></li>
    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/examples.html#Example_Expressions">JEXL examples</a></li>
    </ul>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Expression</td>
<td>
        The expression to be evaluated. For example, <tt class="code">6*(5+2)</tt>
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>
The following variables are made available to the script:
</p><ul>
<li><tt class="code">log</tt> - the <a href="https://www.slf4j.org/api/org/slf4j/Logger.html">Logger</a> for the function</li>
<li><tt class="code">ctx</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object</li>
<li><tt class="code">vars</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterVariables.html">JMeterVariables</a> object</li>
<li><tt class="code">props</tt> - JMeterProperties (class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html"><tt class="code">java.util.Properties</tt></a>) object</li>
<li><tt class="code">threadName</tt> - String containing the current thread name</li>
<li><tt class="code">sampler</tt> - current <a href="../../docs/api/org/apache/jmeter/samplers/Sampler.html">Sampler</a> object (if any)</li>
<li><tt class="code">sampleResult</tt> - previous <a href="../../docs/api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a> object (if any)</li>
<li><tt class="code">OUT</tt> - System.out - e.g. <tt class="code">OUT.println(&quot;message&quot;)</tt></li>
</ul><p>
    Jexl can also create classes and call methods on them, for example:
    </p><p>
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
Systemclass=log.class.forName(&quot;java.lang.System&quot;);
now=Systemclass.currentTimeMillis();
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    Note that the Jexl documentation on the web-site wrongly suggests that &quot;<tt class="code">div</tt>&quot; does integer division.
    In fact &quot;<tt class="code">div</tt>&quot; and &quot;<tt class="code">/</tt>&quot; both perform normal division. One can get the same effect
    as follows:
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
i= 5 / 2;
i.intValue(); // or use i.longValue()
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    </p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>JMeter allows the expression to contain multiple statements.</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__jexl3">20.5.19 __jexl3</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The jexl function returns the result of evaluating a
    <a href="http://commons.apache.org/proper/commons-jexl/">Commons JEXL expression</a>.
    See links below for more information on JEXL expressions.
    </p>
    <p>The <tt class="code">__jexl3</tt> function uses Commons JEXL 3</p>
    <ul>
    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/syntax.html">JEXL syntax description</a></li>
    <li><a href="http://commons.apache.org/proper/commons-jexl/reference/examples.html#Example_Expressions">JEXL examples</a></li>
    </ul>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Expression</td>
<td>
        The expression to be evaluated. For example, <tt class="code">6*(5+2)</tt>
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>
The following variables are made available to the script:
</p><ul>
<li><tt class="code">log</tt> - the <a href="https://www.slf4j.org/api/org/slf4j/Logger.html">Logger</a> for the function</li>
<li><tt class="code">ctx</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterContext.html">JMeterContext</a> object</li>
<li><tt class="code">vars</tt> - <a href="../../docs/api/org/apache/jmeter/threads/JMeterVariables.html">JMeterVariables</a> object</li>
<li><tt class="code">props</tt> - JMeterProperties (class <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html"><tt class="code">java.util.Properties</tt></a>) object</li>
<li><tt class="code">threadName</tt> - String containing the current thread name</li>
<li><tt class="code">sampler</tt> - current <a href="../../docs/api/org/apache/jmeter/samplers/Sampler.html">Sampler</a> object (if any)</li>
<li><tt class="code">sampleResult</tt> - previous <a href="../../docs/api/org/apache/jmeter/samplers/SampleResult.html">SampleResult</a> object (if any)</li>
<li><tt class="code">OUT</tt> - System.out - e.g. <tt class="code">OUT.println(&quot;message&quot;)</tt></li>
</ul><p>
    Jexl can also create classes and call methods on them, for example:
    </p><p>
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
Systemclass=log.class.forName(&quot;java.lang.System&quot;);
now=Systemclass.currentTimeMillis();
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    Note that the Jexl documentation on the web-site wrongly suggests that &quot;<tt class="code">div</tt>&quot; does integer division.
    In fact &quot;<tt class="code">div</tt>&quot; and &quot;<tt class="code">/</tt>&quot; both perform normal division. One can get the same effect
    as follows:
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>
i= 5 / 2;
i.intValue(); // or use i.longValue()
</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

    </p><p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>JMeter allows the expression to contain multiple statements.</td></tr>
</table>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__V">20.5.20 __V</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The V (variable) function returns the result of evaluating a variable name expression.
    This can be used to evaluate nested variable references (which are not currently supported).
    </p>
    <p>For example, if one has variables <tt class="code">A1</tt>,<tt class="code">A2</tt> and <tt class="code">N</tt>=<tt class="code">1</tt>:</p>
    <ul>
    <li><tt class="code">${A1}</tt> - works OK</li>
    <li><tt class="code">${A${N}}</tt> - does not work (nested variable reference)</li>
    <li><tt class="code">${__V(A${N})}</tt> - works OK. <tt class="code">A${N}</tt> becomes <tt class="code">A1</tt>, and the <tt class="code">__V</tt> function returns the value of <tt class="code">A1</tt></li>
    </ul>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable name</td>
<td>
        The variable to be evaluated.
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Default value</td>
<td>
        The default value in case no variable found, if it's empty and no variable found function returns the variable name
        </td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__evalVar">20.5.21 __evalVar</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The evalVar function returns the result of evaluating an expression stored in a variable.
    </p>
    <p>
    This allows one to read a string from a file, and process any variable references in it.
    For example, if the variable &quot;<tt class="code">query</tt>&quot; contains &quot;<tt class="code">select ${column} from ${table}</tt>&quot;
    and &quot;<tt class="code">column</tt>&quot; and &quot;<tt class="code">table</tt>&quot; contain &quot;<tt class="code">name</tt>&quot; and &quot;<tt class="code">customers</tt>&quot;, then <tt class="code">${__evalVar(query)}</tt>
    will evaluate as &quot;<tt class="code">select name from customers</tt>&quot;.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable name</td>
<td>
        The variable to be evaluated.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__eval">20.5.22 __eval</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The eval function returns the result of evaluating a string expression.
    </p>
    <p>
    This allows one to interpolate variable and function references in a string
    which is stored in a variable.    For example, given the following variables:
    </p>
    <ul>
    <li><tt class="code">name</tt>=<tt class="code">Smith</tt></li>
    <li><tt class="code">column</tt>=<tt class="code">age</tt></li>
    <li><tt class="code">table</tt>=<tt class="code">birthdays</tt></li>
    <li><tt class="code">SQL</tt>=<tt class="code">select ${column} from ${table} where name='${name}'</tt></li>
    </ul>
    then <tt class="code">${__eval(${SQL})}</tt> will evaluate as &quot;<tt class="code">select age from birthdays where name='Smith'</tt>&quot;.

    <p>
    This can be used in conjunction with CSV Dataset, for example
    where the both SQL statements and the values are defined in the data file.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable name</td>
<td>
        The variable to be evaluated.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__char">20.5.23 __char</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The char function returns the result of evaluating a list of numbers as Unicode characters.
    See also <tt class="code">__unescape()</tt>, below.
    </p>
    <p>
    This allows one to add arbitrary character values into fields.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Unicode character number (decimal or 0xhex)</td>
<td>
        The decimal number (or hex number, if prefixed by <tt class="code">0x</tt>, or octal, if prefixed by <tt class="code">0</tt>) to be converted to a Unicode character.
        </td>
<td>
Yes
</td>
</tr>
</table>
<p>Examples:
<br>

<tt class="code">${__char(13,10)}</tt> = <tt class="code">${__char(0xD,0xA)}</tt> = <tt class="code">${__char(015,012)}</tt> = <tt class="code">CRLF</tt>
<br>

<tt class="code">${__char(165)}</tt> = <tt class="code">¥</tt> (yen)
 </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__unescape">20.5.24 __unescape</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The unescape function returns the result of evaluating a Java-escaped string. See also <tt class="code">__char()</tt> above.
    </p>
    <p>
    This allows one to add characters to fields which are otherwise tricky (or impossible) to define via the GUI.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to unescape</td>
<td>
        The string to be unescaped.
        </td>
<td>
Yes
</td>
</tr>
</table>
<p>Examples:
<br>

<tt class="code">${__unescape(\r\n)}</tt> = <tt class="code">CRLF</tt>
<br>

<tt class="code">${__unescape(1\t2)}</tt> = <tt class="code">1</tt>[tab]<tt class="code">2</tt>
 </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__unescapeHtml">20.5.25 __unescapeHtml</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function to unescape a string containing HTML entity escapes
to a string containing the actual Unicode characters corresponding to the escapes.
Supports HTML 4.0 entities.
</p>
<p>
For example, the string <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__unescapeHtml(&amp;lt;Fran&amp;ccedil;ais&amp;gt;)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

will return <tt class="code">&lt;Français&gt;</tt>.
</p>
<p>
If an entity is unrecognized, it is left alone, and inserted verbatim into the result string.
e.g. <tt class="code">${__unescapeHtml(&amp;gt;&amp;zzzz;x)}</tt> will return <tt class="code">&gt;&amp;zzzz;x</tt>.
</p>
    <p>
    Uses <tt class="code">StringEscapeUtils#unescapeHtml(String)</tt> from Commons Lang.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to unescape</td>
<td>
        The string to be unescaped.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__escapeHtml">20.5.26 __escapeHtml</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function which escapes the characters in a String using HTML entities.
Supports HTML 4.0 entities.
</p>
<p>
For example,<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__escapeHtml(&quot;bread&quot; &amp; &quot;butter&quot;)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

return:
<tt class="code">&amp;quot;bread&amp;quot; &amp;amp; &amp;quot;butter&amp;quot;</tt>.
</p>
    <p>
    Uses <tt class="code">StringEscapeUtils#escapeHtml(String)</tt> from Commons Lang.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to escape</td>
<td>
        The string to be escaped.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__urldecode">20.5.27 __urldecode</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function to decode a <tt class="code">application/x-www-form-urlencoded</tt> string.
Note: use UTF-8 as the encoding scheme.
</p>
<p>
For example, the string <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__urldecode(Word+%22school%22+is+%22%C3%A9cole%22+in+french)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns
 <tt class="code">Word &quot;school&quot; is &quot;école&quot; in french</tt>.
</p>
    <p>
    Uses Java class <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URLDecoder.html">URLDecoder</a>.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to decode</td>
<td>
        The string with URL encoded chars to decode.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__urlencode">20.5.28 __urlencode</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function to encode a string to a <tt class="code">application/x-www-form-urlencoded</tt> string.
</p>
<p>
For example, the string <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__urlencode(Word &quot;school&quot; is &quot;école&quot; in french)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns
 <tt class="code">Word+%22school%22+is+%22%C3%A9cole%22+in+french</tt>.
</p>
    <p>
    Uses Java class <a href="http://docs.oracle.com/javase/7/docs/api/java/net/URLEncoder.html">URLEncoder</a>.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to encode</td>
<td>
        String to encode in URL encoded chars.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__FileToString">20.5.29 __FileToString</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The FileToString function can be used to read an entire file.
    Each time it is called it reads the entire file.
    </p>
    <p>If an error occurs opening or reading the file, then the function returns the string &quot;<tt class="code">**ERR**</tt>&quot;</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>File Name</td>
<td>Path to the file name.
            (The path can be relative to the JMeter launch directory)
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>File encoding if not the platform default</td>
<td>
        The encoding to be used to read the file. If not specified, the platform default is used.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>
A reference name - <tt class="code">refName</tt> - for reusing the value created by this function. Stored values are of the form <tt class="code">${refName}</tt>.
        </td>
<td>
No
</td>
</tr>
</table>
<p>The file name, encoding and reference name parameters are resolved every time the function is executed.</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__samplerName">20.5.30 __samplerName</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The samplerName function returns the name (i.e. label) of the current sampler.
    </p>
    <p>
    The function does not work in Test elements that don't have an associated sampler.
    For example the Test Plan.
    Configuration elements also don't have an associated sampler.
    However some Configuration elements are referenced directly by samplers, such as the HTTP Header Manager
    and Http Cookie Manager, and in this case the functions are resolved in the context of the Http Sampler.
    Pre-Processors, Post-Processors and Assertions always have an associated Sampler.
    </p>
    <p>Example: <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__samplerName()}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable Name</td>
<td>
A reference name - <tt class="code">refName</tt> - for reusing the value created by this function. Stored values are of the form <tt class="code">${refName}</tt>.
        </td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__TestPlanName">20.5.31 __TestPlanName</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The TestPlanName function returns the name of the current test plan (can be used in Including Plans to know the name of the calling test plan).
    </p>
<p>Example:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__TestPlanName}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return the file name of your test plan, for example if plan is in a file named Demo.jmx, it will return &quot;<tt class="code">Demo.jmx</tt><br>

</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__escapeOroRegexpChars">20.5.32 __escapeOroRegexpChars</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function which escapes the ORO Regexp meta characters, it is the equivalent of <tt class="code">\Q</tt> <tt class="code">\E</tt> in Java Regexp Engine.
</p>
<p>
For example,<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__escapeOroRegexpChars([^&quot;].+?,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

returns:
<tt class="code">\[\^\&quot;\]\.\+\?</tt>.
</p>
    <p>
    Uses Perl5Compiler#quotemeta(String) from ORO.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to escape</td>
<td>
        The string to be escaped.
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Variable Name</td>
<td>
A reference name - <tt class="code">refName</tt> - for reusing the value created by this function. Stored values are of the form <tt class="code">${refName}</tt>.
        </td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__escapeXml">20.5.33 __escapeXml</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
Function which escapes the characters in a String using XML 1.0 entities.
</p>
<p>
For example,<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__escapeXml(&quot;bread&quot; &amp; 'butter')}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>

returns:
<tt class="code">&amp;quot;bread&amp;quot; &amp;amp; &amp;apos;butter&amp;apos;</tt>.
</p>
    <p>
    Uses <tt class="code">StringEscapeUtils#escapeXml10(String)</tt> from Commons Lang.
    </p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to escape</td>
<td>
        The string to be escaped.
        </td>
<td>
Yes
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__timeShift">20.5.22 __timeShift</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>The timeShift function returns a date in the given format with the specified amount of seconds, minutes, hours, days or months added</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Format</td>
<td>
        The format to be passed to DateTimeFormatter.
        See <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html">DateTimeFormatter</a>
        If omitted, the function uses milliseconds since epoch format.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Date to shift</td>
<td>
        Indicate the date in the format set by the parameter 'Format' to shift
        If omitted, the date is set to now
        </td>
<td>
No
</td>
</tr>
<tr>
<td>value to shift</td>
<td>
        Indicate the specified amount of seconds, minutes, hours or days to shift according to a textual representation of a duration such as PnDTnHnMn.nS. See https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence-
        <ul>
        <li><tt class="code">PT20.345S</tt> parses as 20.345 seconds</li>
        <li><tt class="code">PT15M</tt> parses as 15 minutes</li>
        <li><tt class="code">PT10H</tt> parses as 10 hours</li>
        <li><tt class="code">P2D</tt> parses as 2 days</li>
        <li><tt class="code">-P6H3M</tt> parses as -6 hours and -3 minutes</li>
        </ul>
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Locale to use for format</td>
<td>
        The string format of a locale. The language code must be lowercase. The country code must be uppercase. The separator must be an underscore. ex: en_EN
        See http://www.oracle.com/technetwork/java/javase/javase7locales-334809.html
        If omitted, by default the function use the ApacheJMeter locale one.
        </td>
<td>
No
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__timeShift(dd/MM/yyyy,21/01/2018,P2D,,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">23/01/2018</tt>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__timeShift(dd MMMM yyyy,21 février 2018,P2D,fr_FR,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">23 février 2018</tt>
</p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__digest">20.5.34 __digest</a>
</h3>
</font>
</td></tr>
<tr><td>

        <p>The digest function returns an encrypted value in the
            specific hash algorithm with the optional salt, upper case
            and variable name.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Algorithm</td>
<td>
            The algorithm to be used to encrypt
            For possible algorithms See MessageDigest in
            <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html">StandardNames</a>
            <ul>
                <li>MD2</li>
                <li>MD5</li>
                <li>SHA-1</li>
                <li>SHA-224</li>
                <li>SHA-256</li>
                <li>SHA-384</li>
                <li>SHA-512</li>
            </ul>
            <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td>Spaces are taken into account for <tt class="code">Salt to add</tt> and <tt class="code">String to encode</tt></td></tr>
</table>
</p>

        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>String to encode</td>
<td> The String
            that will be encrypted </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Salt to add</td>
<td> Salt to be added
            to string (after it)</td>
<td>
No
</td>
</tr>
<tr>
<td>Upper Case value</td>
<td> Result will
            be in lower case by default. Choose true to upper case
            results. </td>
<td>
No
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of
            the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
        <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__digest(MD5,Errare humanum est,,,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">c49f00b92667a35c63708933384dad52</tt><br>

        <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__digest(SHA-256,Felix qui potuit rerum cognoscere causas,mysalt,,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">a3bc6900fe2b2fc5fa8a601a4a84e27a079bf2c581d485009bc5c00516729ac7</tt><br>


    </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__dateTimeConvert">20.5.35 __dateTimeConvert</a>
</h3>
</font>
</td></tr>
<tr><td>

        <p>The <tt class="code">__dateTimeConvert</tt> function converts a date that is in source format
        to a target format storing the result optionally in the variable name.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Date String</td>
<td>
            The date string to convert from Source Date Format to Target Date Format. A date as a epoch time could be use here if Source Date Format is empty.
        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Source Date Format</td>
<td>The original date format. If empty, the Date String field must be a epoch time.</td>
<td>
No
</td>
</tr>
<tr>
<td>Target Date Format</td>
<td>The new date format</td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>Example:
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__dateTimeConvert(01212018,MMddyyyy,dd/MM/yyyy,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">21/01/2018</tt>
    </p><p>
    With epoch time value: 1526574881000, <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__dateTimeConvert(1526574881000,,dd/MM/yyyy HH:mm,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 returns <tt class="code">17/05/2018 16:34</tt> in UTC time(-Duser.timezone=GMT)
    </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__isPropDefined">20.5.36 __isPropDefined</a>
</h3>
</font>
</td></tr>
<tr><td>

        <p>The <tt class="code">__isPropDefined</tt> function returns true if property exists or false if not.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Property Name</td>
<td>
            The Property Name to be used to check if defined
        </td>
<td>
Yes
</td>
</tr>
</table>
<p>Example: <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__isPropDefined(START.HMS)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">true</tt></p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__isVarDefined">20.5.37 __isVarDefined</a>
</h3>
</font>
</td></tr>
<tr><td>

        <p>The <tt class="code">__isVarDefined</tt> function returns true if variable exists or false if not.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Variable Name</td>
<td>
            The Variable Name to be used to check if defined
        </td>
<td>
Yes
</td>
</tr>
</table>
<p>Example: <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__isVarDefined(JMeterThread.last_sample_ok)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">true</tt></p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__changeCase">20.5.38 __changeCase</a>
</h3>
</font>
</td></tr>
<tr><td>

        <p>The change case function returns a string value which
        case has been changed following a specific mode.
        Result can optionally be saved in a JMeter variable.</p>
    <p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>String to change case</td>
<td>The String
            which case will be changed</td>
<td>
Yes
</td>
</tr>
<tr>
<td>change case mode</td>
<td>
            The mode to be used to change case, for example for <tt class="code">ab-CD eF</tt>:
            <ul>
                <li><tt class="code">UPPER</tt> result as AB-CD EF</li>
                <li><tt class="code">LOWER</tt> result as ab-cd ed</li>
                <li><tt class="code">CAPITALIZE</tt> result as Ab-CD eF</li>
            </ul>
            <p>
<table border="1" bgcolor="#bbbb00" width="50%" cellspacing="0" cellpadding="2">
<tr><td><tt class="code">change case mode</tt> is case insensitive</td></tr>
</table>
</p>

        </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Name of variable</td>
<td>The name of the variable to set.</td>
<td>
No
</td>
</tr>
</table>
<p>Examples:
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__changeCase(Avaro omnia desunt\, inopi pauca\, sapienti nihil,UPPER,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">AVARO OMNIA DESUNT, INOPI PAUCA, SAPIENTI NIHIL</tt>
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__changeCase(LABOR OMNIA VINCIT IMPROBUS,LOWER,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">labor omnia vincit improbus</tt>
    <div align="left">
<table cellspacing="4" cellpadding="0" border="0">
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#ffffff"><pre>${__changeCase(omnibus viis romam pervenitur,CAPITALIZE,)}</pre></td>
<td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
<tr>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
<td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
</tr>
</table>
</div>
 will return <tt class="code">Omnibus viis romam pervenitur</tt>
    </p></td></tr>
<tr><td><br></td></tr>
</table>
<hr>
<table border="0" cellspacing="0" cellpadding="2">
<tr><td>
<font face="arial,helvetica,sanserif">
<h3>
<a name="__StringToFile">20.5.39 __StringToFile</a>
</h3>
</font>
</td></tr>
<tr><td>

    <p>
    The <tt class="code">__StringToFile</tt> function can be used to write a string to a file.
    Each time it is called it writes a string to file appending or overwriting.
    </p>
    <p>The default return value from the function is the empty string</p>
<p>
<b>Parameters</b>
</p>
<table border="1" cellspacing="0" cellpadding="2">
<tr><th>Attribute</th><th>Description</th><th>Required</th></tr>
<tr>
<td>Path to file</td>
<td>
    Path to the file name.(The path is absolute)
    </td>
<td>
Yes
</td>
</tr>
<tr>
<td>String to write</td>
<td>
    The string to write to the file. <br>

    If you need to insert a line break in your content, use <tt class="code">\n</tt> in your string.
    </td>
<td>
Yes
</td>
</tr>
<tr>
<td>Append to file?</td>
<td>
    The way to write the string, <tt class="code">true</tt> means append, <tt class="code">false</tt>
    means overwrite. If not specified, the default append is <tt class="code">true</tt>.
    </td>
<td>
No
</td>
</tr>
<tr>
<td>File encoding if not UTF-8</td>
<td>
    The encoding to be used to write to the file. If not specified, the default encoding is <tt class="code">UTF-8</tt>.
    </td>
<td>
No
</td>
</tr>
</table>
</td></tr>
<tr><td><br></td></tr>
</table>
<hr>
</blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="predefinedvars"><strong>20.6 Pre-defined Variables</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
Most variables are set by calling functions or by test elements such as User Defined Variables;
in which case the user has full control over the variable name that is used.
However some variables are defined internally by JMeter. These are listed below.
</p><ul>
<li><tt class="code">COOKIE_cookiename</tt> - contains the cookie value (see <a href="../usermanual/component_reference.html#HTTP_Cookie_Manager">HTTP Cookie Manager</a>)</li>
<li><tt class="code">JMeterThread.last_sample_ok</tt> - whether or not the last sample was OK - <tt class="code">true</tt>/<tt class="code">false</tt>.
Note: this is updated after PostProcessors and Assertions have been run.
</li>
<li><tt class="code">START</tt> variables (see next section)</li>
</ul></blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
<table border="0" cellspacing="0" cellpadding="2" width="100%">
<tr><td bgcolor="#828DA6">
<font color="#ffffff" face="arial,helvetica,sanserif">
<a name="predefinedprops"><strong>20.6 Pre-defined Properties</strong></a>
</font>
</td></tr>
<tr><td>
<blockquote>
<p>
The set of JMeter properties is initialised from the system properties defined when JMeter starts;
additional JMeter properties are defined in <tt class="code">jmeter.properties</tt>, <tt class="code">user.properties</tt> or on the command line.
</p><p>
Some built-in properties are defined by JMeter. These are listed below.
For convenience, the <tt class="code">START</tt> properties are also copied to variables with the same names.
</p><ul>
<li><tt class="code">START.MS</tt> - JMeter start time in milliseconds</li>
<li><tt class="code">START.YMD</tt> - JMeter start time as <tt class="code">yyyyMMdd</tt></li>
<li><tt class="code">START.HMS</tt> - JMeter start time as <tt class="code">HHmmss</tt></li>
<li><tt class="code">TESTSTART.MS</tt> - test start time in milliseconds</li>
</ul><p>
Please note that the <tt class="code">START</tt> variables / properties represent JMeter startup time, not the test start time.
They are mainly intended for use in file names etc.
</p></blockquote>
</td></tr>
<tr><td><br></td></tr>
</table>
</blockquote>
</p>
</td></tr>
<tr><td><br></td></tr>
</table>
<br>
<table>
<tr>
<td bgcolor="#525D76">
<div align="right"><a href="index.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Index</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="regular_expressions.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Next</font></a></div>
</td>
<td bgcolor="#525D76">
<div align="right"><a href="properties_reference.html"><font size=-1 color="#ffffff" face="arial,helvetica,sanserif">Prev</font></a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr><td>
<hr noshade size="1"/>
</td></tr>
<tr>
<td>
<table width=100%>
<tr>
<td>
<font color="#525D76" size="-1"><em>
Copyright &copy; 1999-2020, Apache Software Foundation
</em></font>
</td>
<td align="right">
<font color="#525D76" size="-1"><em>
$Id$
</em></font>
</td>
</tr>
<tr><td colspan="2">
<div align="center"><font color="#525D76" size="-1">
Apache, Apache JMeter, JMeter, the Apache feather, and the Apache JMeter logo are
trademarks of the Apache Software Foundation.
</font>
</div>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<!-- end the processing -->















































